<?php

namespace App\Http\Controllers;

use App\Library\Requests\Base\BasePageRequest;
use App\Library\Requests\Base\IdRequest;
use App\Library\Requests\Message\MessageAddObjectRequest;
use App\Library\Requests\Message\MessageAddRequest;
use App\Library\Requests\Message\MessageNewRequest;
use App\Library\Requests\Message\MessagePageRequest;
use App\Library\Requests\Message\MessageReadRequest;
use App\Library\Requests\Message\MessageUserInfoRequest;
use App\Library\Service\MessageService;
use Illuminate\Http\JsonResponse;

class MessageController extends BaseController
{
    /**
     * @param MessageService $service
     */
    public function __construct(MessageService $service)
    {
        $this->service = $service;
    }

    /**
     * 分页
     * @param MessagePageRequest $request
     * @return JsonResponse
     */
    public function paging(MessagePageRequest $request): JsonResponse
    {
        return $this->service->paging($request);
    }

    /**
     * 最新
     * @param MessageNewRequest $request
     * @return JsonResponse
     */
    public function new(MessageNewRequest $request): JsonResponse
    {
        return $this->service->new($request);
    }

    /**
     * add
     * @param MessageAddRequest $request
     * @return JsonResponse
     */
    public function add(MessageAddRequest $request): JsonResponse
    {
        return $this->service->add($request);
    }

    /**
     * addObject
     * @param MessageAddObjectRequest $request
     * @return JsonResponse
     */
    public function addObject(MessageAddObjectRequest $request): JsonResponse
    {
        return $this->service->addObject($request);
    }

    /**
     * userInfo
     * @param MessageUserInfoRequest $request
     * @return JsonResponse
     */
    public function userInfo(MessageUserInfoRequest $request): JsonResponse
    {
        return $this->service->userInfo($request);
    }

    /**
     * messageList
     * @param BasePageRequest $request
     * @return JsonResponse
     *
     */
    public function messageList(BasePageRequest $request): JsonResponse
    {
        return $this->service->messageList($request);
    }

    /**
     * read
     * @param MessageReadRequest $request
     * @return JsonResponse
     *
     */
    public function read(MessageReadRequest $request): JsonResponse
    {
        return $this->service->read($request);
    }

    /**
     * kefu
     * @param IdRequest $request
     * @return JsonResponse
     */
    public function kefu(IdRequest $request): JsonResponse
    {
        return $this->service->kefu($request);
    }

    /**
     * count
     * @return JsonResponse
     */
    public function count(): JsonResponse
    {
        return $this->service->count();
    }
}
